package com.sky.mapper.common;

import com.sky.aop.AutoFill;
import com.sky.enumeration.OperationType;
import com.sky.pojo.DishFlavor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishFlavorMapper {


    void BatchSave(@Param("flavors") List<DishFlavor> flavors);

    void deleteByIds(@Param("ids") Long[] ids);

    @Select("select * from dish_flavor where dish_id = #{id}")
    List<DishFlavor> list(Long id);

    @Delete("delete from dish_flavor where dish_id = #{id}")
    void deleteByDishId(Long id);


    /**
     * 根据菜品ID查询对应的口味列表
     * @param dishId 菜品ID
     * @return 口味列表
     */
    @Select(" SELECT * FROM dish_flavor WHERE dish_id = #{dishId}")
    List<DishFlavor> getByDishId(Long dishId);
}
